#include <iostream>
using namespace std;

int main()
{
    int arraySize;
    cout << "请输入数组长度: ";
    cin >> arraySize;
    int *arr = new int[arraySize];

    srand((unsigned)time(0));
    for (int i = 0; i < arraySize; i++)
    {
        arr[i] = rand() % 1000 + 1;
    }

    for (int i = 0; i < arraySize; i++)
    {
        cout << arr[i] << " ";
    }
    cout<<endl;
    int maxNum=0;
    for (int i = 0; i < arraySize; i++)
    {
        if(arr[i]>maxNum){
            maxNum=arr[i];
        }
    }
    cout<<"数组中最大数为："<<maxNum<<endl;
    delete[] arr;
}